<%= render :partial =>'search' %>
<table class="table">
	<tr>
		<th <%= sort_td_class_helper 'priority' %>><%= sort_link_helper 'P', 'priority' %></th>
		<th <%= sort_td_class_helper 'id' %>><%= sort_link_helper 'ID', 'id' %></th>
		
		<th <%= sort_td_class_helper 'name' %>><%= sort_link_helper 'Name', 'name' %></th>
		<th style="width:150px;">Tag's</th>
		<th <%= sort_td_class_helper 'status' %>><%= sort_link_helper 'Status', 'status' %></th>
		<th <%= sort_td_class_helper 'ticket_type' %>><%= sort_link_helper 'Type', 'ticket_type' %></th>
		<th <%= sort_td_class_helper 'owner_id' %>><%= sort_link_helper 'Owner', 'owner_id' %></th>
		<th <%= sort_td_class_helper 'end_date' %>><%= sort_link_helper 'End', 'end_date' %></th>
		<th <%= sort_td_class_helper 'hours' %>><%= sort_link_helper 'Time', 'hours' %></th>
		<th <%= sort_td_class_helper 'user_id' %>><%= sort_link_helper 'Created by', 'user_id' %></th>
		<th <%= sort_td_class_helper 'updated_at' %>><%= sort_link_helper 'Changed @', 'updated_at' %></th>
	</tr>
	<% for ticket in @tickets -%>
	<tr class="<%= cycle('even', 'odd')+'_list' %>">
		<td><%= image_tag("priority_" + Ticket.priorities.invert[ticket.priority] + ".png", :alt => Ticket.priorities.invert[ticket.priority].titleize + " Priority", :title => Ticket.priorities.invert[ticket.priority].titleize + " Priority"  ) %></td>
		<td>#<%= ticket.id %></td>
		<td><%= link_to truncate(ticket.name.humanize, 55, '...'), :controller => 'ticket', :action => 'show', :id => ticket %></td>
		<td><%= ticket.tags.collect{|t| link_to(t.name.downcase, :controller => 'project', :project => @project, :action => 'tag',  :tag => t.name.downcase)}.sort{|x,y| x.downcase <=> y.downcase}.join(", ") %>
		<td><%= Ticket.states.invert[ticket.status].titleize %></td>
		<td><%= Category.find(ticket.ticket_type).name.titleize %></td>
		<td><%= ticket.owner.login if !ticket.owner.nil?  %></td>
		<td><%= ticket.end_date if !ticket.end_date.nil? %> </td>
		<td><%= ("#{ticket.time_spend} / #{ticket.hours}") if !ticket.hours.nil? %> </td>
		<td><%= ticket.user.login if !ticket.user.nil?  %></td>
		<td><%= ticket.updated_at.strftime("%d-%m-%Y %H:%M") %></td>
	</tr>
	<% end -%>
</table>